<?php
namespace addons\paotui\service;

class PosterNotice
{

    public $model;

    public function __construct()
    {
        $this->model = new \app\admin\model\paotui\Posternotice();
    }

    /**
     * 获取通知列表
     * @param $page
     * @param $limit
     * @throws \think\Exception
     */
    public function getNoticeList($page,$limit){
        $count = $this->model->count();
        if($page){
            $data = $this->model->page($page,$limit)->order("datetime desc")->select();
        }else{
            $data = $this->model->order("datetime desc")->select();
        }

        return ['total'=>$count,'data'=>$data];
    }


    /**
     * 获取订单详情
     * @param $id
     * @return array|bool|\PDOStatement|string|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getNoticeInfo($id){
        return $this->model->where(['id'=>$id])->find();
    }

}